package ru.dadle8.service.impl.command.workout;

import org.springframework.stereotype.Service;
import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.Update;
import org.telegram.telegrambots.meta.exceptions.TelegramApiException;
import ru.dadle8.model.bot.BotConsts;
import ru.dadle8.model.bot.type.CommandState;
import ru.dadle8.service.impl.command.AbstractCommandService;

@Service
public class FillWorkoutsCommandServiceImpl extends AbstractCommandService {

    @Override
    public CommandState getCommandState() {
        return CommandState.FILL_WORKOUTS;
    }

    @Override
    public void processUpdate(Update update) throws TelegramApiException {
        if (getInMess().getForwardFromChat() != null && BotConsts.CHANNEL_WITH_WORKOUTS.equals(getInMess().getForwardFromChat().getId())) {
            getWorkoutService().fillWorkout(getInMess());
        }
    }
}
